#include <stdint.h>
#include <xen/xen.h>
+#include <xen/hvm/ioreq.h>
#define ASCII32(a,b,c,d) \
(((a) << 0) | ((b) << 8) | ((c) << 16) | ((d) << 24))
#define ACPI_CPU_SW_SLP (1 << 13)
#define ACPI_USE_PLATFORM_CLOCK (1 << 15)
+/* PM1 Control Register Bits */
+#define ACPI_PM1C_SCI_EN (1 << 0)
+
/*
* Firmware ACPI Control Structure (FACS).
*/
#include "pci_regs.h"
#include "option_rom.h"
#include "apic_regs.h"
+#include "acpi/acpi2_0.h"
#include <xen/version.h>
#include <xen/hvm/params.h>
return NULL;
}
+static void acpi_enable_sci(void)
+{
+ uint8_t pm1a_cnt_val;
+
+#define PIIX4_SMI_CMD_IOPORT 0xb2
+#define PIIX4_ACPI_ENABLE 0xf1
+
+ /*
+ * PIIX4 emulation in QEMU has SCI_EN=0 by default. We have no legacy
+ * SMM implementation, so give ACPI control to the OSPM immediately.
+ */
+ pm1a_cnt_val = inb(ACPI_PM1A_CNT_BLK_ADDRESS_V1);
+ if ( !(pm1a_cnt_val & ACPI_PM1C_SCI_EN) )
+ outb(PIIX4_SMI_CMD_IOPORT, PIIX4_ACPI_ENABLE);
+
+ pm1a_cnt_val = inb(ACPI_PM1A_CNT_BLK_ADDRESS_V1);
+ BUG_ON(!(pm1a_cnt_val & ACPI_PM1C_SCI_EN));
+}
+
int main(void)
{
const struct bios_config *bios;
bios->acpi_build_tables();
}
+ acpi_enable_sci();
+
hypercall_hvm_op(HVMOP_set_param, &p);
}